i=eval(input())
for j in range(i):
    m=eval(input())
    if m%2!=0:
        print("0 0")
    else:
        if m%4!=0:
            n=m/4+1
        else:
            n=m/4
        print("{} {}".format(int(n),int(m/2)))